<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/6/28
  Time: 16:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html >
<head>
    <title>Title</title>
    <!--引入layui样式文件-->
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>

<div class="layui-form-item">
    <label class="layui-form-label">入住号</label>
    <div class="layui-input-block">
        <input type="text" id="checkInNum"   class="layui-input"  disabled="disabled"
               style="width: 200px;">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">房间号码</label>
    <div class="layui-input-block">
        <input type="text" id="roomNum"   class="layui-input"
               style="width: 200px;">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">房间价格</label>
    <div class="layui-input-block">
        <input type="text" id="roomPrice"   class="layui-input" disabled="disabled"
               style="width: 200px;" disabled="disabled">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">电话</label>
    <div class="layui-input-block">
        <input type="text" id="telephone"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">押金</label>
    <div class="layui-input-block">
        <input type="text" id="deposit"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">居住时间</label>
    <div class="layui-input-block">
        <input type="text" id="livingDaysNum"   class="layui-input"
               style="width: 200px;">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">房间总价</label>
    <div class="layui-input-block">
        <input type="text" id="roomTotalPrice"   class="layui-input"
               style="width: 200px;">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">其他花费</label>
    <div class="layui-input-block">
        <input type="text" id="expense"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">总价</label>
    <div class="layui-input-block">
        <input type="text" id="totalPrice"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">应退押金</label>
    <div class="layui-input-block">
        <input type="text" id="refundedDeposit"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">支付方式</label>
    <div class="layui-input-block">
        <input type="text" id="payWay"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">找零</label>
    <div class="layui-input-block">
        <input type="text" id="change"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">操作人员</label>
    <div class="layui-input-block">
        <input type="text" id="operatorId"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">付费</label>
    <div class="layui-input-block">
        <input type="text" id="paid"   class="layui-input"
               style="width: 200px;" >
    </div>
</div>


<button class="layui-btn layui-btn-normal"
        style="margin-left: 200px;" onclick="save()">保存</button>
</body>
<script src="layui/layui.js"></script>

<script>
    var $;
    layui.use(['jquery'],function(){
        $ = layui.jquery;
        $("#roomNum").blur(function () {
            $.ajax({
                url: "getRoomByRoomNum",
                type: "post",
                data: {roomNum: $("#roomNum").val()},
                dataType: "json",
                success: function (param) {
                    if (param.code == 0) {
                        $("#roomPrice").val(param.data.discountPrice);
                    }
                },
                error: function () {
                }

            })

        });
    });

    function save(){
        var index = parent.layer.getFrameIndex(window.name);
        window.parent.updateCheckOut($("#checkInNum").val(),$("#roomNum").val(),$("#roomPrice").val(),$("#telephone").val(),$("#deposit").val(),$("#livingDaysNum").val(),$("#roomTotalPrice").val(),$("#expense").val(),$("#totalPrice").val(),$("#refundedDeposit").val(),$("#payWay").val(),$("#change").val(),$("#operatorId").val(),$("#paid").val());
        parent.layer.close(index);
    }

</script>
</html>